<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let obj = {
        username: '小明',
        age: 17,
        address: '北京市'
        };
        localStorage.setItem('obj', JSON.stringify(obj));
        console.log(localStorage.getItem('obj'))
        console.log(JSON.parse(localStorage.getItem('obj')));
    </script>
</body>
</html>